def sans():
    global r,x,y,o,g,t,h,t,m,cuowu,cuo
    import time,random
    r = 0
    x = 0
    y = 0
    o = 0
    g = 6   #告诉程序一共听写几次
    m = 0
    cuo = 0
    t = {}
    h = {}
    t = {}
    cuowu = {}
    yi = {'pen':'钢笔','pencil':'铅笔','pencil box':'铅笔盒','ruler':'尺子','eraser':'橡皮','crayon':'蜡笔','book':'书','bag':'书包','sharpener':'卷笔刀','school':'学校'}
    er = {'head':'头','face':'脸','nose':'鼻子','mouth':'嘴','eye':'眼睛','ear':'耳朵','arm':'胳膊','finger':'手指','leg':'腿','foot':'脚','body':'身体'}
    san = {'red':'红色的','yellow':'黄色的','green':'绿色的','blue':'蓝色的','purple':'紫色的','white':'白色的','black':'黑色的','orange':'橙色的','pink':'粉色的','brown':'棕色的'}
    si = {'cat':'猫','dog':'狗','monkey':'猴子','panda':'熊猫','bird':'鸟','rabbit':'兔子','duck':'鸭子','pig':'猪','bear':'熊','elephant':'大象','mouse':'老鼠','squirrel':'松鼠'}
    wu = {'cake':'蛋糕','bread':'面包','hot dog':'热狗','hamburger':'汉堡包','chicken':'鸡肉','french fries':'榨薯条','Coke':'可乐','juice':'果汁','milk':'牛奶','water':'水','tea':'茶','coffee':'咖啡'}
    liu = {'one':'一','two':'二','three':'三','four':'四','five':'五','six':'六','seven':'七','eight':'八','nine':'九','ten':'十','doll':'玩具娃娃','boat':'小船','ball':'球','kite':'风筝','balloon':'气球','car':'小汽车','plane':'飞机'}
    e = {0:yi,1:er,2:san,3:si,4:wu,5:liu}
    def q(v):
        global r,x,y,o,g,t,h,t,m,cuowu,cuo
        dict_key_ls = list(v.keys())
        random.shuffle(dict_key_ls)
        new_dic = {}
        for key in dict_key_ls:
            new_dic[key] = v.get(key)
        v = new_dic
        for i in v:
            cuowu = v[i]
            if cuowu == "教师办公室":
                q = input(cuowu + "：")
                w = i 
            else:
                q = input(cuowu + '：')
                w = i 
            if q == w:
                print('对喽！')
                r += 1
            else:
                print('错啦错啦！')
                t[cuowu] = w
                x += 1
        print('结束！')
        print('一共对',r,'道，错',x,'道')
        if x != 0:
            cuo += 1
            print('\n不扎实',x,'道！巩固错题：')
            x = 0
            for i in t:
                if i == "讲台":
                    q = input(i + "：")
                    w = i 
                else:
                    q = input(i + '：')
                    w = i
                w = t[i]
                if q == w:
                    print('对喽！')
                    y += 1
                else:
                    print('错啦错啦！')
                    o += 1
                    m += 1
                    x += 1
                    h[i] = w
            print('结束！')
            print('一共对',y,'道，错',o,'道')
        r = 0
        c = 0
        y = 0
        o = 0
        x = 0
        t = {}
    for l in range(g):
        print('\n第',l+1,'单元！\n')
        v = e[l]
        q(v)
    if m != 0:
        html = open('cuowu.txt','r')
        php = html.read()
        html.close()
        go = open('cuowu.txt','a')
        print('\n错题答案：共',m,'个二错单词\n')
        for i in h:
            d = h[i]
            print(i , d)
            if i not in php or d not in php:
                go.write("'")
                go.write(i)
                go.write("'")
                go.write(':')
                go.write("'")
                go.write(d)
                go.write("'")
                go.write(',\n')
        go.close()
    time.sleep(10)